﻿<%@ Control Language="C#" AutoEventWireup="false" CodeFile="Collection.ascx.cs" Inherits="Controls_Collection" %>
<%@ Register Src="~/Controls/Collection/Payments.ascx" TagName="PaymentsMB" TagPrefix="UI"  %>
<style>
cool\:tip{behavior: url(/Include/HTC/cooltip_js.htc)}
TABLE.GridView.Bridge TH INPUT.Filter{	text-transform:uppercase;	behavior1: url(/Include/HTC/TipMe.htc)}
CAPTION {BEHAVIOR: url(/Include/HTC/Toggle.htc);COLOR:navy;FONT-WEIGHT:bold}
TABLE.GridView TD.BorderRight{	border-right-width:1px;	border-right-color: Black}
TABLE.GridView TD.NextDue{background-color:#F5F5F5}
TABLE.GridView TD.Red{background-color:#FFE5E5}
TABLE.GridView TD.RedDark{color:#B80000}
TABLE.GridView TD.GreenDark{color:#006600}
TABLE.GridView TD.U A{color:black;text-decoration:none}
TABLE.GridView TD.U A.Bold{font-weight:bold}
TABLE.GridView TR TD,TH {font-size:<%=ddlFontSize.SelectedValue%>}
TABLE.Big TD,TH {font-size:<%=ddlFontSize.SelectedValue%>}
.Big{font-size:<%=ddlFontSize.SelectedValue%>}
.button INPUT {overflow:visible;padding:0px 3px;vertical-align:middle}
.button SELECT {vertical-align:middle}
SPAN.CheckBox INPUT{border:none;vertical-align:middle}
</style>
<fieldset><legend><label><b>Filters</b></label></legend>
<div style="font-size:80%" nowrap>
<asp:UpdatePanel ID="upFilters" runat="server" UpdateMode="Always"><ContentTemplate>
<asp:PlaceHolder ID="phFilters" runat="server">
</asp:PlaceHolder>
</ContentTemplate></asp:UpdatePanel>
</div>
</fieldset>
<div id="divGrid"><!-- Bridge -->
<asp:UpdatePanel ID="upBridge" UpdateMode="Always" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="ddlFontSize" />
</Triggers>
<ContentTemplate>
<DS:ProfileFiltersDataSource ID="dsProfileFilters" runat="server" />
<DS:CollectionListDataSource ID="ds" FilterDefault="1=0"
		SelectList="*,'*'+RIGHT(SSN,4)SSN4,'*'+RIGHT(VIN,6)VIN6,CONVERT(bit,CASE WHEN [Status Code] IN ('O','L') AND DPD > 0 THEN 1 ELSE 0 END) ShowDPD" runat="server" />
<span title="Change Font Size">
<asp:DropDownList ID="ddlFontSize" style="background-color:#D1FFDC;vertical-align:middle" AutoPostBack="true" runat="server">
<asp:ListItem Text="100%" Value="100%" />
<asp:ListItem Text="120%" Value="120%" Selected="True" />
<asp:ListItem Text="140%" Value="140%" />
<asp:ListItem Text="160%" Value="160%" />
</asp:DropDownList></span>
<asp:Button ID="txtClearFilters" OnClick="ClearFilters" runat="server" Text="Reset" style="vertical-align:middle" />
<input type="button" Value="Activity" title="Click to see current activity" onclick="showActivity()" style="vertical-align:middle" />
<input type="button" value="Tasks" onclick="openTasks()" style="vertical-align:middle" />
<asp:CheckBox ID="chkToday" Checked="false" runat="server" Font-Bold="true" Text="Show Collected Today" AutoPostBack="true" CssClass="CheckBox" />
<UI:GridViewMB ID="grv" runat="server" AutoGenerateColumns="false" DataSourceID="ds"
	ShowFooter="false" AllowSorting="true" AllowUserSorting="false" CellPadding="0" PageSize="3"
	AllowEdit="false" ShowDelete="false" RowStyle-HorizontalAlign="Right"
	RowStyle-Font-Size="XX-Small" RowStyle-CssClass="Big"
	Caption="" CaptionAlign="Left" CssClass="Bridge"
	EnableViewState="true" DataKeyNames="UsixID,CompanyID_Raw,ApplID">
	<Columns>
<asp:TemplateField HeaderText="LoanID" SortExpression="ApplID">
<ItemTemplate>
	<span style="cursor:hand;font-weight:bold;color:Navy" title='Click to open <%#Eval("ApplID")%>'
		onclick='<%#ShowApplicantJS(Eval("ApplID"))%>'><%#Eval("ApplID")%>
	</span>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UsixID" SortExpression="UsixID">
	<ItemTemplate>
		<span title='<%#Eval("Open Field#01")+""==""?"[Open Field#01] : "+Eval("Open Field#01"):"Click to open by [Open Field#01] : "+Eval("Open Field#01")%>'
					onclick='<%#Eval("Open Field#01")+""==""?"":ShowApplicantJS(Eval("Open Field#01"))%>'
		><%#Eval("UsixID")%></span>
	</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<span title='1-AFC,2-BayQuest,3-Heller4,4-AFQuest,5-Structured'>U</span>" SortExpression="CompanyID" ItemStyle-CssClass="U">
	<ItemTemplate>
		<%#Eval("CompanyID")%>
	</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SSN" SortExpression="SSN">
	<ItemTemplate><span title='<%#Eval("SSN")+" : " + Eval("Name")%>'><%#Eval("SSN4")%></span>
	</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="VIN" SortExpression="VIN">
	<ItemTemplate><span title='<%#Eval("VIN")%>'><%#Eval("VIN6")%></span>
	</ItemTemplate>
</asp:TemplateField>

<asp:BoundField DataField="NameLast" ItemStyle-HorizontalAlign="Left" HeaderText="Last Name" SortExpression="NameLast"></asp:BoundField>
<asp:BoundField DataField="NameFirst" ItemStyle-HorizontalAlign="Left" HeaderText="First Name" SortExpression="NameFirst"></asp:BoundField>
<asp:BoundField DataField="Status Code" HeaderText="<span title='Status Code'>SC</span>"  HtmlEncode="false" SortExpression="Status Code"></asp:BoundField>
<asp:BoundField DataField="Next Payment Date" ItemStyle-CssClass="NextDue" DataFormatString="{0:MM/dd/yy}" HtmlEncode="false" HeaderText="NextPmt" SortExpression="Next Payment Date"></asp:BoundField>

<asp:TemplateField HeaderText="DPD" ItemStyle-CssClass="RedDark" SortExpression="DPD">
	<ItemTemplate><span style='color:<%#Eval("ShowDPD")+""=="False"?"gray":""%>'><%#Eval("DPD")%></span>
	</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DPDR" ItemStyle-CssClass="RedDark" SortExpression="DPDCalc">
	<ItemTemplate><%#Eval("DPDCalc")%>
	</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DSLP" ItemStyle-CssClass="RedDark" SortExpression="DSLP">
	<ItemTemplate><span style='color:<%#Eval("ShowDPD")+""=="False"?"gray":""%>'><%#Eval("DSLP")%></span>
	</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="<span title='Collection [Due Date] Since'>DDS</span>" SortExpression="DueDateSince">
	<ItemTemplate><%#Eval("DueDateSince","{0:n0}")%></ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DaysSinceLastNote" HeaderText="<span title='Days Since Last Note'>DSLN</span>"  HtmlEncode="false" SortExpression="DaysSinceLastNote"></asp:BoundField>

<asp:BoundField DataField="Pymnt Schedule" HeaderText="<span title='Payments Schedule (M,S,B,W)'>PS</span>"  HtmlEncode="false" SortExpression="Pymnt Schedule"></asp:BoundField>
<asp:BoundField DataField="Simple_Add-On" HeaderText="<span title='Loan Type(S1-Simple,A1-Rule 78)'>LT</span>"  HtmlEncode="false" SortExpression="Simple_Add-On"></asp:BoundField>
<asp:BoundField DataField="# of PaymentsM" HeaderText="Pmts" SortExpression="# of PaymentsM" DataFormatString="{0:n0}" HtmlEncode="false"></asp:BoundField>
<asp:BoundField DataField="PaymentsMadeM" ItemStyle-CssClass="GreenDark" HeaderText="<span title='Payments Made'>PM</span>"  HtmlEncode="false" SortExpression="PaymentsMadeM" DataFormatString="{0:n0}"></asp:BoundField>
<asp:BoundField DataField="PaymentsExpectedM" HeaderText="<span title='Payments Expected'>PE</span>"  HtmlEncode="false" SortExpression="PaymentsExpectedM" DataFormatString="{0:n0}"></asp:BoundField>
<asp:BoundField DataField="PaymentsBehindM" ItemStyle-CssClass="RedDark" HeaderText="<span title='Payments Behind'>PB</span>"  HtmlEncode="false" SortExpression="PaymentsBehindM" DataFormatString="{0:n0}"></asp:BoundField>
<asp:BoundField DataField="# Pmts RemainingM" HeaderText='<span title="Payments Remaining">PR</span>' DataFormatString="{0:n0}" HtmlEncode="false" SortExpression="# Pmts Remaining"></asp:BoundField>
<asp:BoundField DataField="PaymentsMadeByPrinBal" HeaderText="<span title='Payments Made By PrinBal'>PMPB</span>"  HtmlEncode="false" SortExpression="PaymentsMadeByPrinBal" DataFormatString="{0:n0}"></asp:BoundField>
<asp:BoundField DataField="Payment Amount" HeaderText="Pmt" SortExpression="Payment Amount"></asp:BoundField>
<asp:BoundField DataField="PastDueAmount" HeaderText="<span title='Past Due Amount'>PD$</span>"  HtmlEncode="false" SortExpression="PastDueAmount"></asp:BoundField>
<asp:BoundField DataField="Title Received Y_N?" HeaderText="T" SortExpression="Title Received Y_N?"></asp:BoundField>
<asp:BoundField DataField="GL_Days" HeaderText="<span title='Days since G_L Date'>GLD</span>"  HtmlEncode="false" SortExpression="GL_Days"></asp:BoundField>
<asp:BoundField DataField="G_L Date" ItemStyle-CssClass="NextDue" DataFormatString="{0:MM/dd/yy}" HtmlEncode="false" HeaderText="G_L Date" SortExpression="G_L Date"></asp:BoundField>
<asp:BoundField DataField="Amt_ Fin__Disc_ Amt" HeaderText="AmtFin" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Amt_ Fin__Disc_ Amt"></asp:BoundField>
<asp:BoundField DataField="Total Principal" HeaderText="PrnBal" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Total Principal"></asp:BoundField>
<asp:BoundField DataField="Dealer Proceed" HeaderText="DlrProc" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Dealer Proceed"></asp:BoundField>
<asp:BoundField DataField="Dealer Discount" HeaderText="DlrDisc" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Dealer Discount"></asp:BoundField>
<asp:BoundField DataField="Discount%" HeaderText="Disc%" SortExpression="Discount%"></asp:BoundField>
<asp:BoundField DataField="APR" HeaderText="APR" SortExpression="APR"></asp:BoundField>
<asp:BoundField DataField="Total Payments" HeaderText="TotalPmts" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Total Payments"></asp:BoundField>
<asp:BoundField DataField="Finance Charges" HeaderText="FinChg" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Finance Charges"></asp:BoundField>
<asp:BoundField DataField="Interest Income" HeaderText="IntInc" DataFormatString="{0:c}" HtmlEncode="false" SortExpression="Interest Income"></asp:BoundField>
<asp:BoundField DataField="Loan#_Comments" HeaderText="Loan#_Comments" SortExpression="Loan#_Comments"></asp:BoundField>
<asp:BoundField DataField="Dealer Code" HeaderText="<span title='Dealer Code'>DC</span>"  HtmlEncode="false" SortExpression="Dealer Code"></asp:BoundField>

<asp:BoundField DataField="St" HeaderText="St" SortExpression="St"></asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address"></asp:BoundField>
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City"></asp:BoundField>
<asp:BoundField DataField="Zip Code" HeaderText="Zip" SortExpression="Zip Code"></asp:BoundField>
<asp:BoundField DataField="Portfolio#" HeaderText="Portfolio#" SortExpression="Portfolio#"></asp:BoundField>
<asp:BoundField DataField="Investor Client" HeaderText="Investor Client" SortExpression="Investor Client"></asp:BoundField>
<asp:BoundField DataField="Status" HeaderText="<span title='Front End Status'>Status</span>"  HtmlEncode="false" SortExpression="Status"></asp:BoundField>
<asp:BoundField DataField="DateDueBy" HeaderText="<span title='Will be collected by'>Collect By</span>"  HtmlEncode="false" SortExpression="DateDueBy"></asp:BoundField>
<asp:BoundField DataField="Collector Id#" HeaderText="<span title='Collector ID'>CID</span>"  HtmlEncode="false" SortExpression="Collector Id#"></asp:BoundField>

<asp:TemplateField HeaderText="<span title='Day Till PTP'>DTP</span>" SortExpression="DaysToPTP">
	<ItemTemplate><%#Lib.MakeInt(Eval("DaysToPTP")) >= 999 ? "" : Eval("DaysToPTP","{0}")%></ItemTemplate>
</asp:TemplateField>

<asp:BoundField DataField="PTP_Agent" HeaderText="<span title='Promise To Pay Agent'>PTPAgent</span>"  HtmlEncode="false" SortExpression="PTP_Agent"></asp:BoundField>
<asp:BoundField DataField="DateDueBy_Priority" HeaderText="<span title='Collected Priority'>CP</span>"  HtmlEncode="false" SortExpression="DateDueBy_Priority"></asp:BoundField>
<asp:BoundField DataField="NoteLastDate" HeaderText="Note Last Date" DataFormatString="{0:MM/dd/yy}" SortExpression="NoteLastDate"></asp:BoundField>

<asp:BoundField DataField="Bankruptcy Filed Y_N?" HeaderText="<span title='Bankruptcy(Y/N)'>BK</span>"  HtmlEncode="false" SortExpression="Bankruptcy Filed Y_N?"></asp:BoundField>

<asp:TemplateField HeaderText="<span title='Due After Hour'>DAH</span>" SortExpression="DueAfterHour">
	<ItemTemplate><%#Eval("DueAfterHour")%></ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DoCollect" HeaderText="<span title='Do Collect'>DoC</span>"  HtmlEncode="false" SortExpression="DoCollect"></asp:BoundField>

<asp:BoundField DataField="Resale Amt_" HeaderText="<span title='Resale Amount'>Sold</span>" DataFormatString="{0:n0}"  HtmlEncode="false" SortExpression="Resale Amt_"></asp:BoundField>
<asp:BoundField DataField="Chargeoff" HeaderText="Chargeoff" DataFormatString="{0:c0}"  HtmlEncode="false" SortExpression="Chargeoff"></asp:BoundField>
<asp:BoundField DataField="Other Chgs Bal" HeaderText="Other Chgs Bal" DataFormatString="{0:c0}"  HtmlEncode="false" SortExpression="Other Chgs Bal"></asp:BoundField>
<asp:BoundField DataField="Final Repo Date" HeaderText="<span title='Final Repo Date'>FRD</span>" DataFormatString="{0:MM/dd/yy}"  HtmlEncode="false" SortExpression="Final Repo Date"></asp:BoundField>

<asp:BoundField DataField="Status_Collection" HeaderText="<span title='Collection Status'>Coll.Sts.</span>"  HtmlEncode="false" SortExpression="Status_Collection"></asp:BoundField>
<asp:BoundField DataField="Name" ItemStyle-HorizontalAlign="Left" HeaderText="Name" SortExpression="Name"></asp:BoundField>
<asp:BoundField DataField="Make" ItemStyle-HorizontalAlign="Left" HeaderText="Make" SortExpression="Make"></asp:BoundField>
<asp:BoundField DataField="Model" ItemStyle-HorizontalAlign="Left" HeaderText="Model" SortExpression="Model"></asp:BoundField>

<asp:BoundField DataField="PayOff_TP" HeaderText="<span title='Payoff Balance'>POB</span>"  HtmlEncode="false" DataFormatString="{0:c}" SortExpression="PayOff_TP"></asp:BoundField>
	</Columns>
</UI:GridViewMB>
</ContentTemplate></asp:UpdatePanel>
</div>
<asp:UpdatePanel ID="upColl" UpdateMode="Always" runat="server"><ContentTemplate>
<UI:CollectionInfo ID="CollectionInfo" runat="server" />
</ContentTemplate></asp:UpdatePanel>
<ajaxtk:CollapsiblePanelExtender ID="cpPmts" runat="server"
	TargetControlID="pnlPmts"
	CollapseControlID="pnlPmtsHeader" ExpandControlID="pnlPmtsHeader"
	TextLabelID="lblPmtsLabel"
	ImageControlID="imgPmtsPanel"
	CollapsedImage="~/images/Buttons/expand.jpg" ExpandedImage="~/images/Buttons/collapse.jpg"
	Collapsed="true"	CollapsedText="" ExpandedText=""
	SuppressPostBack="true"
></ajaxtk:CollapsiblePanelExtender>
<asp:Panel ID="pnlPmtsHeader" CssClass="PanelHeaderBlue" style="width:100%" runat="server">
<table cellPadding="0" cellSpacing="0"><tr><th Width="1px"><asp:Image ID="imgPmtsPanel" runat="server" />
<td nowrap><label ID="lblPmtsLabel" runat="server">Payments</label></td></tr></table>
</asp:Panel> 
<asp:Panel ID="pnlPmts" runat="server" CssClass="PannelContent">
<asp:UpdatePanel ID="upPmts" UpdateMode="Always" runat="server"><ContentTemplate>
<UI:GridViewMB ID="grvPayments" DataSourceID="dsPmts" runat="server" CaptionAlign="Left" AutoGenerateColumns="false"
		ShowHeader="true" AllowSorting="true" AllowEdit="false" AllowPaging="true" PageSize="15" ShowDelete="false" RowStyle-HorizontalAlign="Right"
>
<Columns>
<!-- #include virtual = "/Controls/Collection/PaymentColumns.asp" -->
</Columns>
</UI:GridViewMB>
</ContentTemplate></asp:UpdatePanel>
</asp:Panel>

<ajaxtk:CollapsiblePanelExtender runat="server" ID="cpComm"
	TargetControlID="pnlComm"
	CollapseControlID="pnlCommHeader" ExpandControlID="pnlCommHeader"
	TextLabelID="lblCommLabel"
	ImageControlID="imgCommPanel"
	CollapsedImage="~/images/Buttons/expand.jpg" ExpandedImage="~/images/Buttons/collapse.jpg"
	Collapsed="true"	CollapsedText="" ExpandedText=""
	SuppressPostBack="false"
></ajaxtk:CollapsiblePanelExtender>
<asp:Panel ID="pnlCommHeader" CssClass="PanelHeaderBlue" style="width:100%" runat="server">
<table cellPadding="0" cellSpacing="0"><tr>
<th Width="1px"><asp:Image ID="imgCommPanel" ImageUrl="~/images/Buttons/expand.jpg" runat="server" />
<td nowrap><label ID="lblCommLabel" runat="server">Comments</label></td>
</tr></table>
</asp:Panel> 
<asp:Panel ID="pnlComm" runat="server" CssClass="PannelContent">
<asp:UpdatePanel ID="upComm" UpdateMode="Always" runat="server"><ContentTemplate>
<UI:GridViewMB ID="grvComments" DataSourceID="dsComments" runat="server" CaptionAlign="Left" AutoGenerateColumns="false"
		ShowHeader="true" AllowSorting="true" AllowEdit="false" AllowPaging="true" ShowDelete="false" RowStyle-HorizontalAlign="Right" PageSize="10"
>
<Columns>
<asp:BoundField DataField="Date" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="false" HeaderText="Date" SortExpression="Date"></asp:BoundField>
<asp:BoundField DataField="Remark" HeaderText="Remark" DataFormatString="<pre style='font-size:125%'>{0}</pre>" HtmlEncode="false" SortExpression="Remark"></asp:BoundField>
<asp:BoundField DataField="Agent" HeaderText="Agent" DataFormatString="<pre style='font-size:125%'>{0}</pre>" HtmlEncode="false" SortExpression="Agent"></asp:BoundField>
<asp:BoundField DataField="Due Date" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="false" HeaderText="Due Date" SortExpression="Due Date"></asp:BoundField>
</Columns>
</UI:GridViewMB>
</ContentTemplate></asp:UpdatePanel>
</asp:Panel>


<UI:Notes ID="Notes" runat="server" />
<asp:UpdatePanel ID="upFilter" UpdateMode="Always" runat="server"><ContentTemplate>
<asp:Literal ID="ltrFilter" runat="server"></asp:Literal>
<asp:Literal ID="ltrMemberOf" runat="server"></asp:Literal>
</ContentTemplate></asp:UpdatePanel>
<fieldset style="width:1px"><legend state="+"><label>Make Payment</label></legend>
<UI:PaymentsMB ID="PmtsMB" runat="server" />
</fieldset>
<DS:USIXPaymentsDataSource ID="dsPmts" runat="server">
<SelectParameters>
<asp:ControlParameter ControlID="dsPmts" PropertyName="Page.UsixID" Name="UsixID" Type="String" />
<asp:ControlParameter ControlID="dsPmts" PropertyName="Page.CompanyID" Name="CompanyID" Type="Int32" />
</SelectParameters>
</DS:USIXPaymentsDataSource>

<DS:USIXCommentsDataSource ID="dsComments" runat="server">
<SelectParameters>
<asp:ControlParameter ControlID="dsPmts" PropertyName="Page.UsixID" Name="UsixID" Type="String" />
<asp:ControlParameter ControlID="dsPmts" PropertyName="Page.CompanyID" Name="CompanyID" Type="Int32" />
</SelectParameters>
</DS:USIXCommentsDataSource>
<cool:tip delay="700" avoidMouse="true" duration="60"></cool:tip>
<script>
setInterval(function(){showExpiration();},1*5000);
document.body.onkeypress = showShortCut;
function showShortCut(){
	if( !event.ctrlKey || !event.shiftKey )return;
	var letter = String.fromCharCode(event.keyCode+"A".charCodeAt(0)-1);
	if( letter == "F" )openUsixID();
}
function InitHeader(){
	var inputs = divGrid.all.tags("INPUT");
	for( var i=0 ; i < inputs.length; i++ ){
		if( inputs[i].type != "text" )continue;
		inputs[i].onkeypress = null;
		inputs[i].delay = 700;
		inputs[i].coolTip = inputs[i].title.replace(/\r\n/g,"<br>");
		inputs[i].title = "";
		inputs[i].onmouseover = function(){
			event.srcElement.style.position = "relative";
			event.srcElement.style.zIndex=1000;
			event.srcElement.style.backgroundColor="white";
			showTip(this);
		};
		inputs[i].onmouseout = function(){
			event.srcElement.style.position = "";
			event.srcElement.style.zIndex=null;
			event.srcElement.style.backgroundColor="";
		};
	}
}
function showTip(el){
//el.coolTip = "Dimok";
	var tip = ((el.coolTip||"").match(/.+?<br>(.+)/)||new Array("",""))[1];
	el.coolTip = (el.value.fontcolor("navy").bold() + "<br>" + tip.replace(/(XXX|YYY|ZZZ)/g,"$1".fontcolor("#B80000").bold()));//.fontsize(3);
}
function showActivity(){
	showModelessDialog("/manager/collection/activity.aspx");
}
function showExpiration(){
	if( typeof(tdCollectionExpiration) == 'undefined' )return;
	WSA.Admin.GetLockInfo(cb,er);
	function er(result){}
	function cb(result){
		var rs = getRSFromDS(result,"Locks");
		var expMessage = "Session Expired".bold().fontcolor("maroon");
		if( rs != null ){
			var expDate = new Date("1/1/1900 "+rs("ExpiresIn").value);
			if( expDate.getMinutes() == 0 && expDate.getSeconds() <= 60 ){
				if( !showExpiration.expPopupShown ){
					showExpiration.expPopupShown = true;
					return refreshExpiration();
				}					
			}else showExpiration.expPopupShown = false;
			expMessage = "Expires In".bold()+"<br>"+rs("ExpiresIn");
		}
		try{
			if( !tdCollectionExpiration.onclick )tdCollectionExpiration.onclick = function(){btnRefresh().click();}
			tdCollectionExpiration.innerHTML = expMessage;
		}catch(e){status = e.description;}
	}
}
function refreshExpiration(){
	if( !confirm("You have less then a minute before session for current Loan expires.\nDo you wish to prolong it?" ) )return false;
		btnRefresh().click();
		true;
}
function openUsixID(){
	var usixID = prompt("USIX ID:","");
	if( !usixID )return;
	showModelessDialog(location.href.split("&")[0]+"?Filter=USIXID='"+usixID+"'",null);
}
</script>
<?XML:NAMESPACE PREFIX="COOL" />
